package test;

/**
 * @author 郝文雪
 * @date 2022/9/1 20:26
 * @Description Test
 */
public class bilibil2 {
    public boolean is_straight (String[] cards) {
        if(cards==null || cards.length==0) return false;
        // write code here
        String s="0A234567891JQK";
        int n=cards.length;
        int min=14;
        int max=-1;
        int[] card=new int[14];
        boolean flag=false;
        int index=0;
        for(int i=0;i<n;i++){
            if(cards[i].equals("大王") || cards[i].equals("小王")){
                index=0;
                card[index]++;
            }else if(cards[i].equals("10")){
                index=10;
                card[10]++;
            }else{
                index=s.indexOf(cards[i]);
                card[index]++;
            }
            if(cards[i].equals("大王")|| cards.equals("小王")){
                continue;
            }
            if(card[index]>1){
                flag=true;
                break;
            }
        }
        if(max-min<5 && !flag){
            return true;
        }
        return false;
    }
}
